package cn.theten52.demo.patterns.design.behavior.state;

/**
 * 分发商品状态类
 *
 * @author wangjin
 * @date 2020/12/30
 */
public class DispenseCommodityState implements State {

    VendingMachine machine;

    public DispenseCommodityState(VendingMachine machine) {
        this.machine = machine;
    }

    @Override
    public void choose() {
        System.out.println("请及时取走您的商品！");
    }

    @Override
    public boolean payment() {
        System.out.println("请及时取走您的商品！");
        return false;
    }

    @Override
    public void dispenseCommodity() {
        System.out.println("请及时取走您的商品！");
        machine.setState(machine.getChooseGoods());
    }
}
